home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / loremipsum.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-10-30  |  3.3 KB  |  131 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. /***************************************************************************
  8.  *                                                                         *
  9.  *   This program is free software; you can redistribute it and/or modify  *
  10.  *   it under the terms of the GNU General Public License as published by  *
  11.  *   the Free Software Foundation; either version 2 of the License, or     *
  12.  *   (at your option) any later version.                                   *
  13.  *                                                                         *
  14.  ***************************************************************************/
  15.  
  16. #ifndef _LOREMIPSUM_H_
  17. #define _LOREMIPSUM_H_
  18.  
  19. #include <QDialog>
  20. #include <QMap>
  21.  
  22. #include "scribusapi.h"
  23.  
  24. class QEvent;
  25. class QGridLayout;
  26. class QHBoxLayout;
  27. class QLabel;
  28. class QPushButton;
  29. class QSpacerItem;
  30. class QSpinBox;
  31. class QCheckBox;
  32. class QString;
  33. class QStringList;
  34. class QTreeWidget;
  35. class QVBoxLayout;
  36.  
  37. class ScribusDoc;
  38. // class LanguageManager;
  39.  
  40.  
  41. /*! \brief XML parser for Lorem Ipsum file.
  42. This helper class reads one file
  43. \author Petr Vanek <petr@yarpen.cz>
  44.  */
  45. class SCRIBUS_API LoremParser
  46. {
  47. public:
  48.     /*! parse a XML file with given name
  49.     \param filename string fith the file name with full/relative path */
  50.     LoremParser(QString filename);
  51.     ~LoremParser(){};
  52.  
  53.     //! Is the LI correct?
  54.     bool correct;
  55.     //! Name to display
  56.     QString name;
  57.     //! Author of the LI
  58.     QString author;
  59.     //! Website of the LI
  60.     QString url;
  61.     //! Paragraphs of the LI
  62.     QStringList loremIpsum;
  63.  
  64.     /*! Construct a LI
  65.     \param parCount count of the paragraphs */
  66.     QString createLorem(uint parCount, bool random = true);
  67. };
  68.  
  69. /*! \brief This module provides simple interface to the various Lorem Ipsum variants.
  70. Scribus LI are stored in the set of XML files.
  71. The file has followind structure:
  72. \<?xml version="1.0" encoding="utf8"?\>
  73. \<lorem\>
  74. \<name\>name to display\</name\>
  75. \<author\>person name\</author\>
  76. \<url\>web interface\</url\>
  77. \<p\>text\</p\>
  78. \<p\>...\</p\>
  79. \</lorem\>
  80. Files are in UTF8 encoding.
  81. \author Petr Vanek <petr@yarpen.cz>
  82. */
  83. class SCRIBUS_API LoremManager : public QDialog
  84. {
  85.     Q_OBJECT
  86.  
  87. public:
  88.     /*! Reads all XML files in cfg directory. */
  89.     LoremManager(ScribusDoc* doc, QWidget* parent = 0);
  90.     ~LoremManager();
  91.     
  92.     
  93.     virtual void changeEvent(QEvent *e);
  94.  
  95.     //! all lorems with Public Name -> filename structure
  96.     QMap<QString,QString> availableLorems;
  97.  
  98.     /*! Apply created LI into a frame
  99.     \param name filename of the selected LI
  100.     \param paraCount count of the paragraphs
  101.     */
  102.     void insertLoremIpsum(QString name, int paraCount, bool random = true);
  103.  
  104. public slots:
  105.     virtual void okButton_clicked();
  106.     virtual void cancelButton_clicked();
  107.  
  108. protected:
  109.     ScribusDoc* m_Doc;
  110.     QTreeWidget* loremList;
  111.     QLabel* paraLabel;
  112.     QSpinBox* paraBox;
  113.     QCheckBox* randomCheckBox;
  114.     QPushButton* okButton;
  115.     QPushButton* cancelButton;
  116.     QGridLayout* LoremManagerLayout;
  117.     QVBoxLayout* layout3;
  118.     QHBoxLayout* layout2;
  119.     QSpacerItem* paraSpacer;
  120.     QHBoxLayout* layout1;
  121.     QSpacerItem* buttonSpacer;
  122. //     LanguageManager* langmgr;
  123.     QString standardloremtext;
  124.  
  125. protected slots:
  126.     virtual void languageChange();
  127.  
  128. };
  129.  
  130. #endif
  131.